<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>用户注册</title>
<link href="css/shoppingCarAndMyCustom.css" type="text/css" rel="stylesheet" />
<link href="css/login.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="js/jquery-1.7.2.js"></script>
<script type="text/javascript" src="js/login.js"></script>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<script type="text/javascript" src="js/jquery-1.7.2.js"></script>
</head>
<script type="text/javascript">
   var reg = /^(\S){2,15}$/;
   var youxiang=/^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
      var ypass=false;
      var ycon=false;
      var ymail=false;
      var yuser=false;
      
     function yanpass(){
     var pass=document.getElementById("password").value;
     var passfont=document.getElementById("passfont");
     if(pass!=""&&pass!=null){
         if(reg.test(pass)){
      
             ypass=true;
            passfont.innerHTML="";
         }
         else{
         
          passfont.innerHTML="长度要在2-15位之间";
         }
      }
      else{
        
        passfont.innerHTML="密码不能为空";
      }
      
      
      
     }
     
     function yancon(){
       var pass=document.getElementById("password").value;
       var con=document.getElementById("confirm").value;
        var confont=document.getElementById("confont");
        if(con!=""&&con!=null) {
         if(con==pass) {
         ycon=true;
          confont.innerHTML="";
      }else{
         confont.innerHTML="确认密码跟原密码不同，请重新输入";
      }
      }
      else{
          confont.innerHTML="确认密码不能为空";
      }
     }
     
   function email(){
     var kkmail=document.getElementById("mail").value;
     var mailfont=document.getElementById("mailfont");
      $.post(
         "yanemail.action",
         {email:kkmail},
         function user(data){
         if(kkmail!=""&&kkmail!=null){
         if(data.str=="false") mailfont.innerHTML="此邮箱已被注册"; 
         else {
         if(youxiang.test(kkmail)){
         ymail=true;
         mailfont.innerHTML="";
         }
         else{
         mailfont.innerHTML="邮箱不符合格式";
         }
         }
         }
         else{
           mailfont.innerHTML="邮箱不能为空";
         }
         },
          "json"
         );
       }
       
       function yonghu(){
    
    var user=document.getElementById("username").value;
    var userfont=document.getElementById("userfont");
     $.post(
         "yanuser.action",
         {username:user},
         function uuser(data){
         if(user!=""&&user!=null){
         if(data.str=="false") userfont.innerHTML="此用户名已被注册";
         else {
         if(reg.test(user)){
         yuser=true;
         userfont.innerHTML="";
         }
         else{
          userfont.innerHTML="用户名需要2-15位";
         }
         }
         }
         else{
         userfont.innerHTML="用户名不能为空";
         }
         },
          "json"
         );
       }
       
       function yan(){
       if(ypass==true&&ycon==true&&ymail==true&&yuser==true)
           return true;
      else  { 
             alert("请按照提示填写完整信息，否则注册不会成功");
              return false;
              }
       }
  
  
  </script>


<body>
<div style="background-color:rgb(102,102,102); width:100%;">
	<div class="head" id="head">
    	<div id="webbei_logol">
        	<img src="img/logo.gif"/>
        </div>
        <div class="usercando">
        	<div class="usercando_dingzhi">
            	<a href=""><img src="img/head_custom.gif"/></a>
            </div>
            <div class="usercando_share">
            	<a href=""><img src="img/head_share.gif"/></a>
            </div>
        </div>
        <div class="search" id="search">
        	<div style="width:100%; height:45px;">
            </div>
            <div style="padding-top:0px;">
            	<div style="float:left;">
        		<input type="text" value="" id="searchsomething" /></div>
                <div style="float:left;">
            	<a href=""><img src="img/head_search_bt.gif"/></a></div>
            </div>
        </div>
        <div class="something_else">
        	<div class="something_else_up">
            	<div style="width:120px; float:left; padding-top:7px;">
            		&nbsp;&nbsp;&nbsp;<a href="">转</a>
                	&nbsp;<a href="">加关注</a>
                </div>
                <div style="width:100px; float:left; padding-top:2px; padding-left: 10px;">
                	<a href=""><img src="img/login_txwb.png"/></a>
                	<a href=""><img src="img/login_rr.png"/></a>
                	<a href=""><img src="img/login_db.png"/></a>
                </div>
            </div>
            <div class="something_else_down">
            	<div style="width:125px; float:left; padding-top:5px; padding-left:10px;">
                	<div style="float:left;">
                		<img src="img/head_cart.gif"/>
                    </div>
                    <div style="float:left; height:20px; padding-top:5px;">
                    	&nbsp;购物车(<a href="">2</a>)
                    </div>
                </div>
                <div class="loginandresign">
                	<div id="login_btn" style="float:left; cursor:pointer;">登陆</div>
                    <div id="resign_btn" style="float:left; cursor:pointer;">|注册</div>
                    <div id="login_level">
                		<div class="login_level_email">
    						邮箱：<input type="text" id="email" />
    					</div>
    					<div class="login_level_email">
    						密码：<input type="text" id="pwd" />
    					</div>
    					<div class="remember_pwd">
    						<input type="checkbox" id="checkbox" />
        					记住密码&nbsp;&nbsp;<a href="">忘记密码？</a>
    					</div>
    					<div class="more_loginway">
    						<img src="img/login_qq.png"/>
        					<img src="img/tianya.png"/>
       				 		<img src="img/twitter.png"/>
        					<img src="img/tuita.png"/>
        					<img src="img/msn.png" />
        					<img src="img/souhuweibo.png"/>
        					<img src="img/qiyiqitan.png"/>
        					<img src="img/more.png" id="moreway"/>
    					</div>
             		</div>
                </div>
            </div>
        </div>
    </div>
</div>
<br />
<form action="register" method="post" enctype="multipart/form-data" onsubmit="return yan();">
<table>
	<tr><td>
		<br /><br />
	</td><td></td><td></td></tr>
	<tr>
		<td width="35%"></td>
		<td align="left" valign="top">
			<table>
	<tr><td>
		<br />
	</td></tr>
	<tr><td>
		<font class="ziti1">注册新账号：<br></font>
		&nbsp;&nbsp;&nbsp;<font class="ziti2">昵称</font>	
		<input type="text" style="width:150px;" name="username" id="username" onblur="yonghu()"/>
		<font id="userfont" color="red">*</font><br />	
	</td></tr>
	<tr><td>
		&nbsp;&nbsp;&nbsp;<font class="ziti2">Email地址</font>
		<input type="text" name="mail" id="mail" onblur="email()" style="width:225px;"/>
		<font id="mailfont" color="blue">*</font>
	</td></tr>
	<tr><td>
		&nbsp;&nbsp;&nbsp;<font class="ziti2">设置密码</font>
		<input type="password" name="password" id="password" onblur="yanpass()" style="width:195px;"/>
		<font id="passfont" color="blue">*</font>
	</td></tr>
	<tr><td>
		&nbsp;&nbsp;&nbsp;<font class="ziti2">确认密码</font>
		<input type="password" name="confirm" id="confirm" onblur="yancon()" style="width:195px;"/>
		<font id="confont" color="blue">*</font>
	<!-- </td></tr>
	<tr><td>
	  &nbsp;&nbsp;&nbsp;<font class="ziti2">爱车头像</font><input type="file" name="file">
	 </td></tr>
	 <tr><td>
	  &nbsp;&nbsp;&nbsp;<font class="ziti2">爱车名字</font><input type="text" name="cheming"/>
	 </td></tr>
	 <tr><td>
	  &nbsp;&nbsp;&nbsp;<font class="ziti2">爱车几岁</font>
	  <select>
	  <option></option>
	  </select>
	 </td></tr>
	 	 <tr><td>
	  &nbsp;&nbsp;&nbsp;<font class="ziti2">爱车牌子</font><input type="file" name="file">
	 </td></tr> -->
	<tr><td>
	    &nbsp;&nbsp;&nbsp;<font class="ziti2">验证码：</font><input type="text" style="width:80px;"/>
		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		<font class="ziti3">看不清？</font>
		<font class="ziti4">换一张</font>
	</td></tr>
	<tr><td>
		<font class="ziti4">请阅读《webbei网贝服务条款》</font>
	</td></tr>
	<tr><td>
		<br />	
	</td></tr>
	<tr><td>
		<input type="submit" value="同意以上条款并注册" id="sub" class="login_Button"/>
	</td></tr>
</table>
		</td>
	</tr>
</table>
</form>
	
</body>
</html>
